function loadResource(initFunc) {
  function getImageList(stage, res) {
    let imageList = {};
    //准备加载的文件列表
    for(var key of Object.keys(res)) {
      let json = res[key];
      if(!json.image || !json.image.file) continue;
      let imgFile = stage + '/' + json.image.file.split(':')[0];
      imageList[imgFile] = 1;
    }
    return Object.keys(imageList);
  }

  function getSoundFile(stage, res) {
    let list = {};
    //准备加载的文件列表
    for(var key of Object.keys(res)) {
      let json = res[key];
      if(!json.sound_list) continue;
      for(let i of json.sound_list) {
        let file = stage + '/' + i;
        list[i] = file.replace('wav', 'ogg').split(':')[0];
      }
    }
    return list;
  }


  //初始化
  PIXI.loader.add('setting.json').load(function (){
    let setting = PIXI.loader.resources['setting.json'].data;
    if(!game.stageName) {
      //读按键配置
      player_glob.inst.readCtrlSet(setting);
      game.stageName = setting.stage[0];
    } else {
      //检查是否有下一关
      let index = setting.stage.indexOf(game.stageName);
      if(index >= setting.stage.length) {
        alert("全部通关了!谢谢");
        return;
      } else {
        game.stageName = setting.stage[index + 1];
      }
    }

    PIXI.loader.add(game.stageName + '/stage_resource.json')
    .load(function (){
      let stageRes = PIXI.loader.resources[game.stageName + '/stage_resource.json'].data;
      //读声音文件
      if(!Const.SOUND_DISABLED) {
        let sound = getSoundFile(game.stageName, stageRes);
        sounds.whenLoaded = function () {
          for(let i of Object.keys(sound)) {
            game.stageSound[i] = sounds[sound[i]];
          }
        };
        sounds.load(Object.values(sound));
      }

      //取要加载的图片文件列表
      let file = getImageList(game.stageName, stageRes);
      //加上关卡文件一起加载
      file.push(game.stageName + '/stage.json');

      PIXI.loader.add(file)
      .on("progress", function (loader, resource) {
        app.stage.children[7].removeChildren();

        let graphics = new PIXI.Graphics();
        // 画带弧边的方形
        graphics.lineStyle(2, 0xFF00FF);
        graphics.beginFill(0x0000FF, 0.7);
        graphics.drawRoundedRect(30, 130, 180, 40, 4);
        graphics.endFill();

        graphics.lineStyle(0, 0xFF00FF);
        graphics.beginFill(0x00FF00, 1);
        graphics.drawRoundedRect(32, 132, 176 * loader.progress / 100, 36, 1);
        graphics.endFill();

        app.stage.children[7].addChild(graphics);

        var text = new PIXI.Text('资源加载中: ' + Math.floor(loader.progress), {fontFamily : 'Arial', fontSize: 24, fill : 0xff1010, align : 'center'});
        text.x = 38;
        text.y = 138;
        app.stage.children[7].addChild(text);
      })
      .load(function() {
        app.stage.children[7].removeChildren();

        initFunc(stageRes);
      });
    });
  });
}